<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	request.setCharacterEncoding("UTF-8");
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String htmlData = request.getParameter("content1") != null
			? request.getParameter("content1")
			: "";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<base href="<%=basePath%>">

<title>编辑分享</title>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<link type="text/css" rel="stylesheet" href="css/participateEdit.css">
<script src="jquery/js/jquery-1.8.2.js"></script>
<script src="jquery/js/jquery-ui-1.9.0.custom.min.js"></script>
<link rel="stylesheet" href="jquery/css/ui-lightness/jquery-ui-1.9.0.custom.min.css" />

<script type="text/javascript"
	src="js/myCustonAndShoppingCar/participateEdit.js"></script>
<link rel="stylesheet" href="<%=basePath%>themes/default/default.css" />
<link rel="stylesheet" href="<%=basePath%>plugins/code/prettify.css" />
<script charset="utf-8" src="<%=basePath%>kindeditor.js"></script>
<script charset="utf-8" src="<%=basePath%>kindeditor-min.js"></script>
<script charset="utf-8" src="<%=basePath%>lang/zh_CN.js"></script>
<script charset="utf-8" src="<%=basePath%>plugins/code/prettify.js"></script>

<script type="text/javascript" src="js/myCustonAndShoppingCar/bgiframe.js"></script>
<script type="text/javascript" src="js/myCustonAndShoppingCar/weebox.js"></script>
<link type="text/css" rel="stylesheet" href="css/xixiaoming/weebox.css" />

<script type="text/javascript">
	var editor1;
  				KindEditor.ready(function(K) {
			 editor1 = K.create('textarea[name="content1"]', {
				cssPath : '<%=basePath%>plugins/code/prettify.css',
				uploadJson : '<%=basePath%>BackstageManagement/upload_json.jsp',
				fileManagerJson : '<%=basePath%>BackstageManagement/file_manager_json.jsp',
									allowFileManager : true,
									afterCreate : function() {
										var self = this;
										K.ctrl(document, 13, function() {
											self.sync();
											document.forms['example'].submit();
										});
										K.ctrl(self.edit.doc, 13, function() {
											self.sync();
											document.forms['example'].submit();
										});
									}
								});
				prettyPrint();
			});
			function test(){
			//alert(editor1.html());
			}

			function updateTheme(){
				var er=editor1.html();
				//alert(er);
				$.getJSON(
					"updateTheme.action",
					{
						theme:er,
						id:$("#hiddenparticipateid").val(),
						type:$("#hiddenparticipatetype").val()
					},function(){
						alert("修改成功");
					}
				);
			}
</script>
<body style="text-align:center;width:100%;margin :0px; padding: 0px;">
	<jsp:include page="top.jsp"></jsp:include>
	<div style="width:1200px;margin:0 auto;">
		<div style="height:7px;text-align:left;">
			<h2>点击图片修改分享出去的默认显示页</h2>
		</div>
		<div>
			<div style="height:30px"></div>
			<div style="float:left;height:400px;width:533px;margin-right:50px;">
				<img  height=400px width=533px
					id="paticipatePicture" src="${participate.orderPic}">
				<div style="position:relative;top:-58px;" id="queding" >
					<a style="font-color:red;font-size:50px;cursor:pointer;" href="javascript:changDefaultDisplayPic();">
						<img alt="" src="img/moren.png">
					</a>
				</div>
				<div style="position:relative;top:-455px;text-align:right;" id="shanchu" >
					<a style="font-color:red;font-size:50px;cursor:pointer;" href="javascript:deletePicture();"><img alt="" src="img/shanchu.png"></a>
				</div>
			</div>
			<div id="moreSelectPic" style="height:400px;">
				<!-- <div style="height:50px;text-align:left;">
					<a style="font-family:黑体;font-size:26px" onclick="showHidden(1);"
						href="javascript:;">已经上传</a>&nbsp;&nbsp; <a
						style="font-family:黑体;font-size:26px" onclick="showHidden(2);"
						href="javascript:;">上传图片</a>&nbsp;&nbsp; <a
						style="font-family:黑体;font-size:26px" onclick="showHidden(3);"
						href="javascript:;">删除图片</a>
				</div> -->
				<div style="height:50px;text-align:left;">
					<a href="javascript:uploaddata()"><img alt="" src="img/shangchuan.png"></a>
				</div>
				<div id="picture" style="height:350px;width:375px;text-align:left;overflow-x: hidden;overflow-y: auto;">
					<%
						Integer size = (Integer) request.getAttribute("size");
						if (size != 0) {
							for (int i = 0; i < size / 3 + 1; i++) {
					%>
					<div style="float:left;margin-left:1px;">
						<c:forEach items="${participate.picList}" var="p" begin="<%=i*3%>"
							end="<%=i*3+2%>">
							<img src="${p.orderPic}"
								onclick="changDefaultDisplayPicture(this.src)" class="top_pic" />
							<br />
						</c:forEach>
					</div>
					<%}}%>
				</div>

				<%-- <div id="deletePic"
					style="height:303px;display:none;text-align:left;">
					<%
						Integer _size = (Integer) request.getAttribute("size");
						if (_size != 0) {
							for (int n = 0; n < _size / 3 + 1; n++) {
					%>
					<div style="float:left;margin-left:1px;">
						<c:forEach items="${participate.picList}" var="p" begin="<%=n*3%>"
							end="<%=n*3+2%>">
							<img src="${p.orderPic}" onclick="deletePicture(this.src)"
								class="top_pic" />
							<br />
						</c:forEach>
					</div>
					<%
						}
						}
					%>
				</div> --%>
			</div>
		</div>
		<div
			style="height:50px;clear:both;text-align:left;text-valign:buttom;padding-top:10px">
			<h2>编写定制介绍</h2>
		</div>
		<%-- <div style="clear:both">
			<textarea name="content1" id="editor_id" cols="100" rows="8"
				style="width:700px;height:200px;visibility:hidden;"><%=htmlspecialchars(htmlData)%></textarea>
		</div> --%>
		<div style="clear:both">
			<textarea name="content1" id="editor_id" cols="100" rows="8"
				style="width:700px;height:200px;visibility:hidden;">${participate.theme}</textarea>
		</div>
		<input type="button" value="确定编辑结果"  style="float:left;margin:5px 0px 0px 50px;" onclick="updateTheme()"/>

	<div style="clear:both;text-align:left;">如果您还没分享该订单/定制，请点击<input type="button" value="分享" onclick="gotoparticipate(${id},'${type}')"/>，如果您已经分享该订单/定制，您无需点击。</div>
	</div>
	<jsp:include page="bottom.jsp"></jsp:include>
	<!-- 上传图片弹出层 -->
	<div id="uploadPic" style="display:none;height:303px;text-align:left;background-color : #fff; overflow: hidden ;">
		<form action="insertOrderPic.action" id="form1" name="form1"
			encType="multipart/form-data" method="post" target="_top">
			<input type="file" name="myfile" /><input type="hidden"
				value="${participate.id}" name="id" id="hiddenparticipateid" /> <input
				type="hidden" name="type" value="${participate.type}"
				id="hiddenparticipatetype" /><input type="submit" value="上传" />
		</form>
	</div>
</body>
</html>

